# !/usr/bin/python3
# -*- coding: utf-8 -*-

"""
参数配置表模型类
----------------------------------------------------
@Project :   xinhou-openai-framework
@File    :   Config.py
@Contact :   sp_hrz@qq.com

@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2023/04/16 22:04  peng.shen   v1.0.0     None
"""

from datetime import datetime
from typing import Optional

from pydantic import BaseModel, Field


class ReqConfigFindSchema(BaseModel):
    """
    参数配置表 查询入参参数&校验模型
    """

    id: Optional[int] = Field(default=None, title="参数主键", )
    config_name: Optional[str] = Field(default=None, title="参数名称", )
    config_key: Optional[str] = Field(default=None, title="参数键名", )
    config_value: Optional[str] = Field(default=None, title="参数键值", )
    config_type: Optional[int] = Field(default=None, title="系统内置:1=是,2=否:index=1", )
    create_by: Optional[str] = Field(default=None, title="创建者", )
    update_by: Optional[str] = Field(default=None, title="更新着", )
    created_at: Optional[datetime] = Field(default=None, title="创建时间", )
    updated_at: Optional[datetime] = Field(default=None, title="更新时间", )
    remark: Optional[str] = Field(default=None, title="备注", )


class ReqConfigSaveSchema(BaseModel):
    """
    参数配置表 保存入参参数&校验模型
    """

    config_name: Optional[str] = Field(title="参数名称", )
    config_key: Optional[str] = Field(title="参数键名", )
    config_value: Optional[str] = Field(title="参数键值", )
    config_type: Optional[int] = Field(title="系统内置:1=是,2=否:index=1", default='1', )
    create_by: Optional[str] = Field(title="创建者", )
    update_by: Optional[str] = Field(title="更新着", )
    remark: Optional[str] = Field(title="备注", )


class ReqConfigUpdateSchema(BaseModel):
    """
    参数配置表 更新入参参数&校验模型
    """

    id: int = Field(title="参数主键", )
    config_name: Optional[str] = Field(default=None, title="参数名称", )
    config_key: Optional[str] = Field(default=None, title="参数键名", )
    config_value: Optional[str] = Field(default=None, title="参数键值", )
    config_type: Optional[int] = Field(default=None, title="系统内置:1=是,2=否:index=1", )
    create_by: Optional[str] = Field(default=None, title="创建者", )
    update_by: Optional[str] = Field(default=None, title="更新着", )
    created_at: Optional[datetime] = Field(default=None, title="创建时间", )
    updated_at: Optional[datetime] = Field(default=None, title="更新时间", )
    remark: Optional[str] = Field(default=None, title="备注", )


class ResConfigDetailSchema(BaseModel):
    """
    参数配置表 查询出参参数&校验模型
    """

    id: Optional[int] = Field(default=None, title="参数主键", )
    config_name: Optional[str] = Field(default=None, title="参数名称", )
    config_key: Optional[str] = Field(default=None, title="参数键名", )
    config_value: Optional[str] = Field(default=None, title="参数键值", )
    config_type: Optional[int] = Field(default=None, title="系统内置:1=是,2=否:index=1", )
    create_by: Optional[str] = Field(default=None, title="创建者", )
    update_by: Optional[str] = Field(default=None, title="更新着", )
    created_at: Optional[datetime] = Field(default=None, title="创建时间", )
    updated_at: Optional[datetime] = Field(default=None, title="更新时间", )
    remark: Optional[str] = Field(default=None, title="备注", )
